
package com.l2jserver.gameserver.model.AntibotCaptchaSystem;

import com.l2jserver.Config;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.skills.AbnormalEffect;

//3 Mins Counter and the event that happens
public class AntibotCaptchaTimer implements Runnable
{
	L2PcInstance activeChar;
	String _sancion;
	
	public AntibotCaptchaTimer(final L2PcInstance player)
	{
		activeChar = player;
	}
	
	@Override
	public void run()
	{
		//here will be code that will run after 1 min
		if (!activeChar.isCodeRight())
		{
			//here will run method with jailing player after 1 min
			activeChar.stopAbnormalEffect(AbnormalEffect.REAL_TARGET);
			final NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(0);
			npcHtmlMessage.setHtml("<html><title>Captcha Antibot System</title><body><center><font color=\"FF0000\">" + String.valueOf(Config.TMODS_ANTIBOT_CAPTCHA_REQUEST_TIME / 60000) + " minutes passed.<br><br></font><font color=\"66FF00\"><center></font><font color=\"FF0000\">You will be jailed.</font><br><button value=\"Exit\" action=\"bypass -h npc_%objectId%_Quest\" width=45 height=25 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></center></body></html>");
			if (activeChar.isFlyingMounted())
				activeChar.untransform();
			if (!activeChar.isInJail()) {
				activeChar.setPunishLevel(L2PcInstance.PunishLevel.JAIL, Config.TMODS_ANTIBOT_CAPTCHA_JAIL_TIME);
			}
			activeChar.setIsInvul(false);
			activeChar.setIsParalyzed(false);
			activeChar.sendPacket(npcHtmlMessage);

			activeChar.resetTries();
			activeChar.resetCaptchaTimmer();
		}
		
	}
}